﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Markup;
 

namespace WpfEffect
{
    /// <summary>
    /// PageBllurEffect.xaml 的交互逻辑
    /// </summary>
    public partial class PageBllurEffect : Page
    {
        public PageBllurEffect()
        {
            InitializeComponent();
            effecct.Changed += new EventHandler(effecct_Changed);
        }

        void effecct_Changed(object sender, EventArgs e)
        {
            textBox1.Text = XamlWriter.Save(effecct);
        }

        private void RenderingBias_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rb = sender as RadioButton;
            if (rb.Content.ToString() == "Performance")
                effecct.RenderingBias = System.Windows.Media.Effects.RenderingBias.Performance;
            else
                effecct.RenderingBias = System.Windows.Media.Effects.RenderingBias.Quality;
        }

        private void KernelType_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rb = sender as RadioButton;
            if (rb.Content.ToString() == "Box")
                effecct.KernelType = System.Windows.Media.Effects.KernelType.Box;
            else
                effecct.KernelType = System.Windows.Media.Effects.KernelType.Gaussian;
        }
    }
}
